package com.haredot.mapper;
import com.haredot.entity.Sys;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@Mapper
public interface SysMapper {

    Sys findBySysName(@Param("sysName")String sysName);

    @CacheEvict(value = "sys:findall", allEntries = true)
    int insert(Sys sys);

    @Cacheable(value="sys:findall")
    List<Sys> findAll();

    @CacheEvict(value = "sys:findall", allEntries = true)
    int updateSys(Sys sys);

    @CacheEvict(value = "sys:findall", key="#a0", allEntries = true)
    int deleteById(Long id);

    @CacheEvict(value = "sys:findall", allEntries = true)
    int batchDelete(List<Long> ids);

    int removeSysMenuBySysId(Long sysId);

    int batchInsertMenusBySysId(@Param("sysId") Long sysId, @Param("menuIds") List<Long> menuIds);
}